public class LoanCalculator {
    int a,m;
    double y,avglnt,avgCap;
    LoanCalculator(int a,int m,double y){
        this.a =a;
        this.m=m;
        this.y=y;
    }

    void avgInterest(){
        double i=y/12;
        avglnt = ((m+1)*a*i)/2;
        System.out.println("等额本金"+avglnt);
    }
    void avgCaption(){
        double i=y/12;
        avgCap =(m*a*i*Math.pow(1+i,m)/Math.pow(1+i,m)-1)-a;
        System.out.println("等额本息"+avgCap);
    }
}
